package com.xxxcompany.world.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


import com.xxxcompany.world.entity.Country;
import com.xxxcompany.world.service.ICountryService;
import com.xxxcompany.world.service.impl.CountryServiceImpl;

@WebServlet("/CountryServlet")
public class CountryServlet extends HttpServlet 
{
	
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setContentType("text/html;charset=utf-8");
		PrintWriter pw = resp.getWriter();
		

				
				ICountryService countryService = new CountryServiceImpl();
				List<Country> county = countryService.findAll();
				req.setAttribute("county", county);
				
				req.getRequestDispatcher("/WEB-INF/country.jsp").forward(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}
}